package com.atde._04_structural_design_patterns.proxy.cglib;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._04_structural_design_patterns.proxy.cglib
 * @Author: Del
 * @CreateTime: 2025-06-24  19:34
 * @Description: 代理模式 --- cglib 代理 --- 测试类
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) {
        // 创建目标对象
        TeacherDao teacherDao = new TeacherDao();

        // 将目标对象传递给代理对象
        ProxyFactory proxyFactory = new ProxyFactory(teacherDao);

        // 获取代理对象
        TeacherDao proxyInstance = (TeacherDao) proxyFactory.getProxyInstance();

        // 执行代理对象的方法，触发 intecept 方法，从而实现 对目标对象的调用
        proxyInstance.teach();
        System.out.println("代理对象：" + proxyInstance.getClass());
    }
}
